using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NTTHAO.CommonWeb;
using NTTHAO.Common.BL;

public partial class admin_webparts_Common_SelectLanguage : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            btnChange.Text = LanguageUtility.GetLanguageText("CHANGE", Session);

            if (!IsPostBack)
            {
                Language lang = new Language();
                DataSet ds = lang.GetAll();
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    cmbLaguage.DataSource = ds.Tables[0];
                    cmbLaguage.DataTextField = Language.NAME__COLUMN_NAME;
                    cmbLaguage.DataValueField = Language.ID__COLUMN_NAME;

                    cmbLaguage.SelectedValue = LanguageUtility.GetLanguageID(Request, Session).ToString();

                    cmbLaguage.DataBind();
                }
            }
        }
        catch (Exception)
        {
        }
    }
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        NTTHAO.CommonWeb.LanguageUtility.SetLanguage(Int32.Parse(cmbLaguage.SelectedValue), Request, Response, Session);

        Response.Redirect("?", false);
    }
}
